[IA64] fix non-CONFIG_XEN sparse tree build
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Wed, 16 Aug 2006 15:15:17 +0000 (09:15 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Wed, 16 Aug 2006 15:15:17 +0000 (09:15 -0600)
   This patch fixes some over-zealous code removal with the P==M
cleanup.  Some of the P==M code was shared with the bare metal kernel.
Also cleaned up a couple places we should have used CONFIG_XEN.

From: Juan Quintela <quintela@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
linux-2.6-xen-sparse/arch/ia64/kernel/setup.c
linux-2.6-xen-sparse/include/asm-ia64/agp.h
linux-2.6-xen-sparse/include/asm-ia64/dma-mapping.h
linux-2.6-xen-sparse/include/asm-ia64/io.h
linux-2.6-xen-sparse/include/asm-ia64/machvec.h
linux-2.6-xen-sparse/include/asm-ia64/page.h
linux-2.6-xen-sparse/include/asm-ia64/pgalloc.h

index 12ab159f0d8181239a33353a5dcfe15dd2708c41..fd49563dd7b965f2f10dd109f151b484d5ec6772 100644 (file)
@@ -565,7 +565,9 @@ setup_arch (char **cmdline_p)
 
        platform_setup(cmdline_p);
        paging_init();
+#ifdef CONFIG_XEN
        contiguous_bitmap_init(max_pfn);
+#endif
 }
 
 /*
index 31bf2831ed36f69c6f2a990b8c9f520fd6d49941..e0bf8a4ab1a05c8dcaa836c2c41aabe543a559eb 100644 (file)
 #define flush_agp_cache()              mb()
 
 /* Convert a physical address to an address suitable for the GART. */
+#ifndef CONFIG_XEN
+#define phys_to_gart(x) (x)
+#define gart_to_phys(x) (x)
+#else
 #define phys_to_gart(x) phys_to_machine_for_dma(x)
 #define gart_to_phys(x) machine_to_phys_for_dma(x)
+#endif
 
 /* GATT allocation. Returns/accepts GATT kernel virtual address. */
+#ifndef CONFIG_XEN
+#define alloc_gatt_pages(order)                \
+       ((char *)__get_free_pages(GFP_KERNEL, (order)))
+#define free_gatt_pages(table, order)  \
+       free_pages((unsigned long)(table), (order))
+#else
 #include <asm/hypervisor.h>
 static inline char*
 alloc_gatt_pages(unsigned int order)
@@ -46,5 +57,6 @@ free_gatt_pages(void* table, unsigned int order)
        xen_destroy_contiguous_region((unsigned long)table, order);
        free_pages((unsigned long)table, order);
 }
+#endif /* CONFIG_XEN */
 
 #endif /* _ASM_IA64_AGP_H */
index a0e6f4200fa509fb905cf4b8563a7f461d3afbd8..5d0206c4691268fa477719da852442490a5de1cb 100644 (file)
@@ -7,11 +7,28 @@
  */
 #include <linux/config.h>
 #include <asm/machvec.h>
+#ifdef CONFIG_XEN
 /* Needed for arch/i386/kernel/swiotlb.c and arch/i386/kernel/pci-dma-xen.c */
 #include <asm/hypervisor.h>
 /* Needed for arch/i386/kernel/swiotlb.c */
 #include <asm-i386/mach-xen/asm/swiotlb.h>
-
+#endif
+
+#ifndef CONFIG_XEN
+#define dma_alloc_coherent     platform_dma_alloc_coherent
+#define dma_alloc_noncoherent  platform_dma_alloc_coherent     /* coherent mem. is cheap */
+#define dma_free_coherent      platform_dma_free_coherent
+#define dma_free_noncoherent   platform_dma_free_coherent
+#define dma_map_single         platform_dma_map_single
+#define dma_map_sg             platform_dma_map_sg
+#define dma_unmap_single       platform_dma_unmap_single
+#define dma_unmap_sg           platform_dma_unmap_sg
+#define dma_sync_single_for_cpu        platform_dma_sync_single_for_cpu
+#define dma_sync_sg_for_cpu    platform_dma_sync_sg_for_cpu
+#define dma_sync_single_for_device platform_dma_sync_single_for_device
+#define dma_sync_sg_for_device platform_dma_sync_sg_for_device
+#define dma_mapping_error      platform_dma_mapping_error
+#else
 int dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
                enum dma_data_direction direction);
 void dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
@@ -50,6 +67,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
                swiotlb_sync_sg_for_device(dev,sg,nelems,direction);
        flush_write_buffers();
 }
+#endif
 
 #define dma_map_page(dev, pg, off, size, dir)                          \
        dma_map_single(dev, page_address(pg) + (off), (size), (dir))
@@ -91,6 +109,7 @@ dma_cache_sync (void *vaddr, size_t size, enum dma_data_direction dir)
 
 #define dma_is_consistent(dma_handle)  (1)     /* all we do is coherent memory... */
 
+#ifdef CONFIG_XEN
 /* arch/i386/kernel/swiotlb.o requires */
 void contiguous_bitmap_init(unsigned long end_pfn);
 
@@ -111,5 +130,6 @@ range_straddles_page_boundary(void *p, size_t size)
        return (((((unsigned long)p & ~PAGE_MASK) + size) > PAGE_SIZE) &&
                !test_bit(__pa(p) >> PAGE_SHIFT, contiguous_bitmap));
 }
+#endif
 
 #endif /* _ASM_IA64_DMA_MAPPING_H */
index 86f6297e38d1a179c09d21ea7712c9dfa7107131..a841d78d79e6b2edb44761707c92f9c6ad5db4ac 100644 (file)
@@ -97,6 +97,11 @@ extern int valid_mmap_phys_addr_range (unsigned long addr, size_t *count);
  * The following two macros are deprecated and scheduled for removal.
  * Please use the PCI-DMA interface defined in <asm/pci.h> instead.
  */
+#ifndef CONFIG_XEN
+#define bus_to_virt    phys_to_virt
+#define virt_to_bus    virt_to_phys
+#define page_to_bus    page_to_phys
+#else
 #define bus_to_virt(bus)       \
        phys_to_virt(machine_to_phys_for_dma(bus))
 #define virt_to_bus(virt)      \
@@ -124,6 +129,7 @@ extern int valid_mmap_phys_addr_range (unsigned long addr, size_t *count);
        (((bvec_to_bus((vec1)) + (vec1)->bv_len) == bvec_to_bus((vec2))) && \
         ((bvec_to_pseudophys((vec1)) + (vec1)->bv_len) ==              \
          bvec_to_pseudophys((vec2))))
+#endif /* CONFIG_XEN */
 
 # endif /* KERNEL */
 
index 1a5158b8d13cd38debbc537708ae722c2ba4ad94..ba0da7b7cf69a789160ab49695bfdddd3a9cb086 100644 (file)
@@ -247,6 +247,7 @@ extern void machvec_init (const char *name);
 #  error Unknown configuration.  Update asm-ia64/machvec.h.
 # endif /* CONFIG_IA64_GENERIC */
 
+#ifdef CONFIG_XEN
 # define platform_dma_map_sg           dma_map_sg
 # define platform_dma_unmap_sg         dma_unmap_sg
 # define platform_dma_mapping_error    dma_mapping_error
@@ -259,6 +260,7 @@ extern void machvec_init (const char *name);
                                        dma_sync_single_for_cpu
 # define platform_dma_sync_single_for_device \
                                        dma_sync_single_for_device
+#endif
 
 /*
  * Declare default routines which aren't declared anywhere else:
index 9a32648e71c8195c2f7d3e1ff40107acdc9c5a3d..67312ea310c4ac5d74431b032eb664492293e42b 100644 (file)
@@ -117,6 +117,9 @@ extern unsigned long max_low_pfn;
 # define pfn_to_page(pfn)      (vmem_map + (pfn))
 #endif
 
+#ifndef CONFIG_XEN
+#define page_to_phys(page)     (page_to_pfn(page) << PAGE_SHIFT)
+#endif
 #define virt_to_page(kaddr)    pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
 #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
 
index 391832423016a1149682b44f090090a8c04ea692..125eeb5362cb9bf7f2675e84a9a76d96afde284c 100644 (file)
@@ -126,7 +126,11 @@ static inline void pmd_free(pmd_t * pmd)
 static inline void
 pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte)
 {
+#ifndef CONFIG_XEN
+       pmd_val(*pmd_entry) = page_to_phys(pte);
+#else
        pmd_val(*pmd_entry) = page_to_pseudophys(pte);
+#endif
 }
 
 static inline void